package itsm.isperp.module.repository.db;

import itsm.isperp.framework.data.domain.DataRequest;
import itsm.isperp.framework.data.domain.DataResponse;
import itsm.isperp.framework.data.mybatis.dao.CUDMapper;
import itsm.isperp.module.entity.db.DbEntityFieldControl;

import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * 
 * 
 * @author lizx
 * @date 2013-5-4
 */
@Repository
public interface DbEntityFieldControlMapper extends
		CUDMapper<DbEntityFieldControl> {

	/**
	 * 根据实体字段删除其控件
	 * 
	 * @param fieldId
	 */
	public void deleteByFieldId(@Param("fieldId") String fieldId);

	/**
	 * 根据实体id删除
	 * 
	 * @param id实体id
	 */
	public void deleteByEntityId(@Param("entityId") String entityId);

	/**
	 * 查询实体中的字段控件
	 * 
	 * @param request
	 *            数据请求
	 * @return 请求结果
	 */
	public DataResponse<Map<String, Object>> findOnEntityByRequest(
			DataRequest request);

	/**
	 * 获取实体字段的控件定义
	 * 
	 * @param id
	 * @return
	 */
	public DbEntityFieldControl findByFieldId(
			@Param("dbFieldId") String dbFieldId);

	public DbEntityFieldControl findByTableAndColumn(
			@Param("tableName") String tableName,
			@Param("columnName") String columnName);

}
